public class Rule {
    private int digit;

    public Rule(int digit){
        this.digit = digit;
    }

    public int hitCounter(int[] num, int[] guess){
        int hit = 0;
        for(int i = 0; i < this.digit; i++)
            if(num[i] == guess[i])	hit++;
        return hit;
    }

    public int blowCounter(int[] num, int[] guess){
        int blow = 0;
        for(int i = 0; i < this.digit; i++)
            for(int j = 0; j < this.digit; j++)
                if(guess[i]==num[j] && i!=j) blow++;
        return blow;
    }

    public int getThousands(int num){
        return num / 1000;
    }

    public int getHundreds(int num){
        return num / 100 % 10;
    }

    public int getTens(int num){
        return num / 10 % 10;
    }

    public int getOnes(int num){
        return num % 10;
    }
}

